function [arg] = get_window_arg(tag, default, direct)

h = findobj('Tag', tag);
if(~ishandle(h)) % just return a default value
   if(ischar(default))
      arg = str2num(default);
   else
      arg = default;
   end
   return;
end
if(nargin < 3)
   arg = str2num(get(h, 'String'));
else
   arg = get(h, 'value'); % just read the value directly
end;


